package com.neuedu.nevserver.controller;

import com.neuedu.nevserver.pojo.SlauBatch;
import com.neuedu.nevserver.pojo.WholBatch;
import com.neuedu.nevserver.service.WholBatchService;
import com.neuedu.nevserver.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sjy
 * @since 2025-03-18
 */
@RestController
@RequestMapping("/whol-batch")
@Api(tags="批发商批号管理",description = "提供批发商批号管理API接口")
public class WholBatchController {

    @Autowired
    private WholBatchService wholBatchService;

    @PostMapping("/addWholBatch")
    @ApiOperation("新增批发商批号")
    public ResultVO addWholBatch(WholBatch wholBatch) throws Exception{
        wholBatch.setBatchDate(new Date());
        wholBatchService.save(wholBatch);
        return ResultVO.success("新增成功");
    }

    @GetMapping("/listWholBatch")
    @ApiOperation("查询批发商产品批号列表")
    public ResultVO<List<WholBatch>> listWholBatch(WholBatch wholBatch) throws Exception{
        return wholBatchService.listWholBatch(wholBatch);
    }
}
